package com.star.files.config;

import io.minio.MinioClient;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * minio配置
 *
 * @author yangzj
 */
@Configuration
@EnableConfigurationProperties(FilesProperties.class)
public class MinioConfig {

    @Resource
    private FilesProperties filesProperties;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(filesProperties.getEndpoint())
                .credentials(filesProperties.getAccessKey(), filesProperties.getSecretKey())
                .build();
    }

}
